import {request,BASEURL} from "./request";

//上传图片
export const upload = (fileBinary, fileType = 'image') => {
	uni.showLoading({
		title:'上传中...'
	})
	return new Promise(resolve => {
		let key = uni.getStorageSync('key');
		uni.uploadFile({
			header:{
				Accept:uni.getStorageSync('token')
			},
			url: BASEURL +'/api/index/upload?user_id=' + uni.getStorageSync('userId'),
			formData:{
				user_id: uni.getStorageSync('userId'),
			},
			filePath: fileBinary,
			name: 'file',
			success: res => {
				uni.hideLoading();
				resolve(JSON.parse(res.data).file_path)
			}
		})
	})
}

//手机号登录
export function storeLogin(data={}) {
	return request({
		url: 'index/storeLogin',
		method: 'POST',
		data,
	})
}
//获取所有部门
export function getbumen(data={}) {
	return request({
		url: 'index/getbumen',
		method: 'get',
		data,
	})
}
//业绩看板
export function yeji(data={}) {
	return request({
		url: 'index/yeji',
		method: 'get',
		data,
	})
}
//下单
export function xiaoshoudan(data={}) {
	return request({
		url: 'index/xiaoshoudan',
		method: 'post',
		data,
	})
}
//获取复核人员列表
export function getguanliyuan(data={}) {
	return request({
		url: 'index/getguanliyuan',
		method: 'get',
		data,
	})
}
//我的
export function my(data={}) {
	return request({
		url: 'index/my',
		method: 'get',
		data,
	})
}
//order_list
export function order_list(data={}) {
	return request({
		url: 'index/order_list',
		method: 'get',
		data,
	})
}
//修改用户头像昵称
export function saveUserInfo(data={}) {
	return request({
		url: 'index/saveUserInfo',
		method: 'POST',
		data,
	})
}

//个人业绩统计
export function danrenyeji(data={}) {
	return request({
		url: 'index/danrenyeji',
		method: 'get',
		data,
	})
}
// 订单详情
export function orderdetail(data={}) {
	return request({
		url: 'index/orderdetail',
		method: 'get',
		data,
	})
}
// 获取销售单信息
export function getXiaoshoudan(data={}) {
	return request({
		url: 'index/getXiaoshoudan',
		method: 'get',
		data,
	})
}
// 获取生产人员
export function getshenchanrenyuan(data={}) {
	return request({
		url: 'index/getshenchanrenyuan',
		method: 'get',
		data,
	})
}

// 获取生产人员
export function fuhexiaoshoudan(data={}) {
	return request({
		url: 'index/fuhexiaoshoudan',
		method: 'post',
		data,
	})
}

// 分配车间
export function paidan(data={}) {
	return request({
		url: 'index/paidan',
		method: 'post',
		data,
	})
}
// 获取单据
export function getdanju(data={}) {
	return request({
		url: 'index/getdanju',
		method: 'post',
		data,
	})
}
// 生产完成操作
export function shengchanwanbi(data={}) {
	return request({
		url: 'index/shengchanwanbi',
		method: 'post',
		data,
	})
}
// 修改单据
export function editdanju(data={}) {
	return request({
		url: 'index/editdanju',
		method: 'post',
		data,
	})
}
//发货
export function fahuo(data={}) {
	return request({
		url: 'index/fahuo',
		method: 'post',
		data,
	})
}
//获取财务核算表
export function getcaiwuhesuan(data={}) {
	return request({
		url: 'index/getcaiwuhesuan',
		method: 'post',
		data,
	})
}
//填写财务核算表
export function caiwuhesuan(data={}) {
	return request({
		url: 'index/caiwuhesuan',
		method: 'post',
		data,
	})
}
//填写财务核算表
export function fuhecaiwuhesuan(data={}) {
	return request({
		url: 'index/fuhecaiwuhesuan',
		method: 'post',
		data,
	})
}
//部门业绩统计
export function bumenrenyeji(data={}) {
	return request({
		url: 'index/bumenrenyeji',
		method: 'get',
		data,
	})
}
export function danrenmaoli(data={}) {
	return request({
		url: 'index/danrenmaoli',
		method: 'get',
		data,
	})
}
export function niandumaoli(data={}) {
	return request({
		url: 'index/niandumaoli',
		method: 'get',
		data,
	})
}
export function yuedumaoli(data={}) {
	return request({
		url: 'index/yuedumaoli',
		method: 'get',
		data,
	})
}
export function getjingli(data={}) {
	return request({
		url: 'index/getjingli',
		method: 'get',
		data,
	})
}
